.TH SQRS 1 "7 January 2009" "WFDB 10.4.12" "WFDB Applications Guide"
.SH NAME
sqrs, sqrs125 \- single-channel QRS detector
.SH SYNOPSIS
\fBsqrs -r\fR \fIrecord\fR [ \fIoptions\fR ... ]
.br
\fBsqrs125 -r\fR \fIrecord\fR [ \fIoptions\fR ... ]
.SH DESCRIPTION
.PP
\fBsqrs\fR attempts to locate QRS complexes in an ECG signal in the specified
\fIrecord\fR.  The detector algorithm is based on example 10 in the \fIWFDB
Programmer's Guide\fR, which in turn is based on a Pascal program
written by W.A.H. Engelse and C. Zeelenberg, ``A single scan algorithm for
QRS-detection and feature extraction'', \fIComputers in Cardiology\fB
6\fR:37-42 (1979).  \fBsqrs\fP does not include the feature extraction
capability of the Pascal program.  The output of \fBsqrs\fR is an annotation
file (with annotator name \fBqrs\fR) in which all detected beats are labelled
normal; the annotation file may also contain `artifact' annotations at
locations that \fBsqrs\fR believes are noise-corrupted.
.PP
\fBsqrs\fR can process records containing any number of signals, but
it uses only one signal for QRS detection (signal 0 by default; this
can be changed using the \fB-s\fR option, see below).  \fBsqrs\fR is
optimized for use with adult human ECGs.  For other ECGs, it may be
necessary to experiment with the sampling frequency as recorded in the
input record's header file (see \fBheader\fR(5)) and the time constants
indicated in the source file.
.PP
\fBsqrs\fR uses the WFDB library's \fIsetifreq\fR function to resample
the input signal at 250 Hz if a significantly different sampling frequency
is indicated in the header file.  \fBsqrs125\fR is identical to \fIsqrs\fR
except that its filter and time constants have been designed for 125 Hz
input, so that its speed is roughly twice that of \fBsqrs\fR.  If the input
signal has been sampled at a frequency near 125 Hz, the quality of the
outputs of \fBsqrs\fR and \fBsqrs125\fR will be nearly identical.  (Note
that older versions of these programs did not resample their inputs;  rather,
they warned if the sampling frequency was significantly different than the
ideal frequency, and suggested using \fBxform\fR(1) to resample the input.)
.PP
This program is provided as an example only, and is not intended for any
clinical application.  At the time the algorithm was originally published,
its performance was typical of state-of-the-art QRS detectors.  Recent designs,
particularly those that can analyze two or more input signals, may exhibit
significantly better performance.
.PP
\fIOptions\fR include:
.TP
\fB-f\fR \fItime\fR
Begin at the specified \fItime\fR in \fIrecord\fR (default: the beginning of
\fIrecord\fR).
.TP
\fB-h\fR
Print a usage summary.
.TP
\fB-H\fR
Read the signal files in high-resolution mode (default: standard mode).
These modes are identical for ordinary records.  For multifrequency records,
the standard decimation of oversampled signals to the frame rate is suppressed
in high-resolution mode (rather, all other signals are resampled at the highest
sampling frequency).
.TP
\fB-m\fR \fIthreshold\fR
Specify the detection \fIthreshold\fR (default: 500 units);  use higher values
to reduce false detections, or lower values to reduce the number of missed
beats.
.TP
\fB-s\fR \fIsignal\fR
Specify the \fIsignal\fR (number or name) to be used for QRS detection (default: 0).
.TP
\fB-t\fR \fItime\fR
Process until the specified \fItime\fR in \fIrecord\fR (default: the end of the
\fIrecord\fR).
.SH ENVIRONMENT
.PP
It may be necessary to set and export the shell variable \fBWFDB\fR (see
\fBsetwfdb\fR(1)).
.SH EXAMPLES
.PP
To mark QRS complexes in record 100 beginning 5 minutes from the start, ending
10 minutes and 35 seconds from the start, and using signal 1, use the command:
.br
	\fBsqrs -r 100 -f 5:0 -t 10:35 -s 1\fR
.br
The output annotations may be read using (for example):
.br
	\fBrdann -a qrs -r 100\fR
.PP
To evaluate the performance of this program, run it on the entire record, by:
.br
	\fBsqrs -r 100\fR
.br
and then compare its output with the reference annotations by:
.br
	\fBbxb -r 100 -a atr qrs\fR
.SH SEE ALSO
\fBbxb\fR(1), \fBrdann\fR(1), \fBsetwfdb\fR(1), \fBwqrs\fR(1), \fBxform\fR(1)
.SH AUTHORS
George B. Moody (george@mit.edu).  This program is a fairly literal translation
with minor corrections of the Pascal original by WAH Engelse and
Cees Zeelenberg.
.SH SOURCE
http://www.physionet.org/physiotools/wfdb/app/sqrs.c
.br
http://www.physionet.org/physiotools/wfdb/app/sqrs125.c
